//
//  UITextField+ZKChain.m
//  ChainFun
//
//  Created by 洪绵卫 on 2022/1/10.
//

#import "UITextField+ZKChain.h"

@implementation UITextField (ZKChain)

+ (UITextField * _Nonnull (^)(void))zk_allocInit{
    return ^{
         UITextField *v = [[UITextField alloc]init];
        return v;
    };
}

+ (UITextField * _Nonnull (^)(CGRect))zk_allocInitWithFrame{
    return ^(CGRect rect){
        UITextField * v = [[UITextField alloc]initWithFrame:rect];
        return v;
    };
}

- (UITextField * _Nonnull (^)(CGRect))zk_frame{
    return ^(CGRect rect){
        self.frame = rect;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIColor * _Nonnull))zk_backgroundColor{
    return ^(UIColor *color){
        self.backgroundColor = color;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIView * _Nonnull))zk_addToSuperView{
    return ^(UIView *view){
        [view addSubview:self];
        return self;
    };
}

- (UITextField * _Nonnull (^)(BOOL))zk_userInteractionEnabled{
    return ^(BOOL isUserInteractionEnabled){
        self.userInteractionEnabled = isUserInteractionEnabled;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSInteger))zk_tag{
    return ^(NSInteger tag){
        self.tag = tag;
        return self;
    };
}

- (UITextField * _Nonnull (^)(CGRect))zk_bounds;{
    return ^(CGRect rect){
        self.bounds = rect;
        return self;
    };
}

- (UITextField * _Nonnull (^)(CGPoint))zk_center{
    return ^(CGPoint point){
        self.center = point;
        return self;
    };
}

- (UITextField * _Nonnull (^)(CGFloat))zk_alpha{
    return ^(CGFloat value){
        self.alpha = value;
        return self;
    };
}

- (UITextField * _Nonnull (^)(BOOL))zk_hidden{
    return ^(BOOL isHidden){
        self.hidden = isHidden;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIColor * _Nonnull))zk_tintColor{
    return ^(UIColor *col){
        self.tintColor = col;
        return self;
    };
}


#pragma mark UITextFeild 的
- (UITextField * _Nonnull (^)(id<UITextFieldDelegate> _Nullable))zk_delegate{
    return ^(id<UITextFieldDelegate> _Nullable delegate){
        self.delegate = delegate;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSString * _Nullable))zk_text{
    return ^(NSString *text){
        self.text = text;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIFont * _Nullable))zk_font{
    return ^(UIFont *font){
        self.font = font;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIColor * _Nullable))zk_textColor{
    return ^(UIColor *color){
        self.textColor = color;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSTextAlignment))zk_textAlignment{
    return ^(NSTextAlignment aligment){
        self.textAlignment = aligment;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSAttributedString * _Nullable))zk_attributedText{
    return ^(NSAttributedString *attr){
        self.attributedText = attr;
        return self;
    };
}
- (UITextField * _Nonnull (^)(UITextBorderStyle))zk_borderStyle{
    return ^(UITextBorderStyle style){
        self.borderStyle = style;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSString * _Nullable))zk_placeholder{
    return ^(NSString *placeholder){
        self.placeholder = placeholder;
        return self;
    };
}

- (UITextField * _Nonnull (^)(NSAttributedString * _Nullable))zk_attributedPlaceholder{
    return ^(NSAttributedString *attributedPlaceholder){
        self.attributedPlaceholder = attributedPlaceholder;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UITextFieldViewMode))zk_clearButtonMode{
    return ^(UITextFieldViewMode mode){
        self.clearButtonMode = mode;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIView * _Nullable))zk_leftView{
    return ^(UIView * leftView){
        self.leftView = leftView;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UITextFieldViewMode))zk_leftViewMode{
    return ^(UITextFieldViewMode mode){
        self.leftViewMode = mode;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIView * _Nullable))zk_rightView{
    return ^(UIView * rightView){
        self.rightView = rightView;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UITextFieldViewMode))zk_rightViewMode{
    return ^(UITextFieldViewMode mode){
        self.rightViewMode = mode;
        return self;
    };
}

- (UITextField * _Nonnull (^)(BOOL))zk_clearsOnBeginEditing{
    return ^(BOOL clearsOnBeginEditing){
        self.clearsOnBeginEditing = clearsOnBeginEditing;
        return self;
    };
}

- (UITextField * _Nonnull (^)(BOOL))zk_adjustsFontSizeToFitWidth{
    return ^(BOOL adjustsFontSizeToFitWidth){
        self.adjustsFontSizeToFitWidth = adjustsFontSizeToFitWidth;
        return self;
    };
}

- (UITextField * _Nonnull (^)(CGFloat))zk_minimumFontSize{
    return ^(CGFloat minimumFontSize){
        self.minimumFontSize = minimumFontSize;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIImage * _Nullable))zk_background{
    return ^(UIImage * img){
        self.background = img;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIImage * _Nullable))zk_disabledBackground{
    return ^(UIImage *img){
        self.disabledBackground = img;
        return self;
    };
}

- (UITextField * _Nonnull (^)(BOOL))zk_allowsEditingTextAttributes{
    return ^(BOOL allowsEditingTextAttributes){
        self.allowsEditingTextAttributes = allowsEditingTextAttributes;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIView * _Nullable))zk_inputView{
    return ^(UIView *inputView){
        self.inputView = inputView;
        return self;
    };
}

- (UITextField * _Nonnull (^)(UIView * _Nullable))zk_inputAccessoryView{
    return ^(UIView *inputAccessoryView){
        self.inputAccessoryView = inputAccessoryView;
        return self;
    };
}

@end
